import java.util.ArrayList;


public class StateList extends ArrayList<BoardState> {
	private int currentStateIndex = 0;
	
	public BoardState getNext() {
	
		currentStateIndex++;
		
		if (currentStateIndex >= this.size()) {
			currentStateIndex = 0;
		}

		return this.get(currentStateIndex);
	}
	
	public BoardState getPrev() {
		
		currentStateIndex--;
		
		if (currentStateIndex < 0) {
			currentStateIndex = this.size()-1;
		}

		return this.get(currentStateIndex);
	}
	
	public BoardState getCurrent() {
		return this.get(currentStateIndex);
	}
	
	public BoardState getLast() {
		currentStateIndex = this.size()-1;
		return this.get(currentStateIndex);
	}
	
	public BoardState getFirst() {
		currentStateIndex = 0;
		return this.get(currentStateIndex);
	}
	
	public int getCurrentStateIndex() {
		return currentStateIndex;
	}
	
	public void setCurrentStateIndex(int i) {
		currentStateIndex = i;
	}
}
